﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace PlanProd.Contracts
{
    [Serializable]
    [DataContract]
    public class Temporada : IAuditable, ILogicalRemoved
    {
        [DataMember]
        public int Id { get; set; }

        [DataMember]
        public string Nombre { get; set; }

        [DataMember]
        public DateTime FechaDesde { get; set; }

        [DataMember]
        public DateTime FechaHasta { get; set; }

        [DataMember]
        public int EmpresaId { get; set; }

        [DataMember]
        public bool Activa { get; set; }

        [DataMember]
        public int NumeroSemanas { get; set; }

        [DataMember]
        public string LetraTemporada { get; set; }

        [DataMember]
        public DateTime AuditFechaCreacion { get; set; }

        [DataMember]
        public string AuditUserNameCreacion { get; set; }

        [DataMember]
        public DateTime? AuditFechaModificacion { get; set; }

        [DataMember]
        public string AuditUserNameModificacion { get; set; }

        [DataMember]
        public bool Removed { get; set; }

        public static int GetCantidadSemanas(DateTime desde, DateTime hasta)
        {
            int semanas = 0;
            DateTime current = desde;
            while (current <= hasta)
            {
                semanas++;
                current = current.AddDays(7);
            }

            return semanas;
        }
    }
}
